#pragma once

#include "DXAMLCommon.h"
#include "ObjectWriterFrame.h"


class ObjectWriterStack
{

public: 
	ObjectWriterStack();
	HRESULT CopyStackTo(ObjectWriterStack & other) const;
	HRESULT PushScope();
	HRESULT PopScope();
	XUINT32 IsEmpty() const;
	ObjectWriterFrame & Current();
	ObjectWriterFrame & Current() const;
	ObjectWriterFrame & Bottom();
	ObjectWriterFrame & Bottom() const;
	ObjectWriterFrame & Parent();
	ObjectWriterFrame & Parent() const;
	XUINT32 Size() const;
	
	xvector<ObjectWriterFrame>::const_reverse_iterator begin() const;
	xvector<ObjectWriterFrame>::reverse_iterator begin();
	xvector<ObjectWriterFrame>::const_reverse_iterator end() const;
	xvector<ObjectWriterFrame>::reverse_iterator end();

	HRESULT AddNamespacePrefix(const xshared_ptr<CXString> & inPrefix, const xshared_ptr<XamlNamespace> & spXamlNamespace);
	HRESULT FindNamespaceByPrefix(const xshared_ptr<CXString> & inPrefix, xshared_ptr<XamlNamespace> & outNamespace);
private: 
	void UpdateIterators();
	xstack<ObjectWriterFrame> m_Stack;
	xvector<ObjectWriterFrame>::reverse_iterator m_itCurrent;
	xvector<ObjectWriterFrame>::reverse_iterator m_itParent;

};



